<!-- eslint-disable vue/multi-word-component-names -->
<template>
    <div id="waters"></div>
  </template>
  
  <script lang="ts" setup>
  import { onMounted } from "vue";
  import * as echarts from "echarts";
  
  onMounted(() => {
    var chartDom = document.getElementById("waters");
    var myChart = echarts.init(chartDom);
  
    let option = {
      tooltip: {
        trigger: "axis",
      },
      grid: {
        top: "4%",
        left: "2%",
        right: "4%",
        bottom: '22%',
        containLabel: true,
      },
      xAxis: {
        type: "category",
        data: [5, 10, 15, 20, 25, 30],
        axisLabel: {
          color: "#CFCFCF",
          interval: 0,
          fontSize: 12,
          formatter: "{value}日",
        },
        axisTick: {
          show: false,
        },
      },
      yAxis: {
        type: "value",
        // data:["0°C", "5°C", "10°C", "20°C", "30°C", "40°C"],
        axisLabel: {
          show: true,
          color: "#CFCFCF",
          fontSize: 12,
          formatter: '{value}万',
        },
  
        splitLine: {
          show: true,
          lineStyle: {
            width: 0.8,
            color: "rgba(127, 214, 255, .4)",
            type: "dashed",
          },
        },
      },
      series: [
        {
          type: "line",
          showSymbol: false,
          smooth: true,
          // symbolSize: 8,
          lineStyle: {
            color: "#00FFF6",
          },
          itemStyle: {
            color: "#00FFF6",
            borderColor: "#00FFF6",
            borderWidth: 2,
          },
          areaStyle: {
            color: {
              type: "linear",
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [
                {
                  offset: 0.25,
                  color: "#00FFF686",
                },
                {
                  offset: 1,
                  color: "#00FFF600",
                },
              ],
            },
          },
          data: [20, 30, 25, 35, 20, 35],
        },
      ],
    };
    option && myChart.setOption(option);
    //监听窗口变化
    window.addEventListener("resize", function () {
      console.log("监听窗口变化");
      myChart.resize();
    });
  });
  </script>
  
  <style scoped>
  #waters {
      width: 100%;
      height: 100%;
  }
  
  
  </style>